<script>
$(document).ready(function(){
	$('#warehouse_code').change(function(){
		var tmp=$(this);
		$.ajax({
			type: "POST",
			url: "<?php echo $this->url(array("controller"=>"inbound-detail","action"=>"ajax-load-location","module"=>"inbound"),null,true);?>",
			data: {"location_warehouse_code":tmp.val()},
			async: false,
			success: function(html){
				$('#location_code').html(html);
			}
		});		
	});
	$("#warehouse_code").trigger('change');
});
</script>

<!-- thanh toolbar -->
<?php $act = (string)$this->inbound_type == '1' ? 'insert-out' : 'insert-in' ;?>
<?php $this->placeholder('toolbar')->captureStart();?>
<?php echo $this->partial('index/toolbar/excel.phtml', 'admin') ?>
<?php echo $this->partial('index/toolbar/excel-all.phtml', 'admin') ?>
<?php $this->placeholder('toolbar')->captureEnd();?>
<!-- / -->

<form id='adminForm' name='adminForm' method='post' action=''>
<dl class="zend_form">

	<!-- phần tìm kiếm -->	
	<div class='formSearh'>
	<fieldset>
		<legend>Thông tin tìm kiếm</legend>
		<?php echo $this->form->adminAction;?>
		<?php echo $this->form->unit_code;?>	
		<?php echo $this->form->warehouse_code;?>
		<?php echo $this->form->location_code;?>
	</fieldset>
	</div>	
	<!-- / -->
	
	<!-- danh sách hiển thị -->
	<div class='clr'> </div>
	<fieldset>
		<legend>BÁO CÁO LƯU TRỮ KHO</legend>
		<table class='adminlist'>
			<thead>			
				<tr>
					<?php echo $this->partial('index/manage/no-save-order.phtml', 'admin'); ?>
					<th >
						Kho
					</th>
					<th >
						Vị trí kho
					</th>
					<th >
						Hàng hóa lưu trữ
					</th>
					<th>
						Sức chứa
					</th>
					<th>
						Hiện đang lưu trữ
					</th>
					<th>
						Còn chứa được
					</th>
				</tr>
			</thead>
			<tbody>
				<?php if($this->paginator){$no=1;foreach ($this->paginator as $row){?>
				<tr>
					<?php echo $this->partial('index/manage/order.phtml', 'admin',array($no++)); ?>
					<td >
						<?php echo $row->m_Array['warehouse_name'];?>
					</td>
					<td >
						<?php echo $row->m_Array['location_name'];?>
					</td>
					<td >
						<?php echo $row->location_contain_product_code." - ".$row->m_Array['product_name'];?>
					</td>
					<td class="right">
						<?php $location_contain_max=$row->location_contain_max;echo $this->partial('index/format/float.phtml','admin',array($location_contain_max))?>
					</td>
					<td class="right">
						<?php $inventory_quantity=$row->m_Array['inventory_quantity'];echo $this->partial('index/format/float.phtml','admin',array($inventory_quantity))?>
					</td>
					<td class="right">
						<?php if(!is_string($location_contain_max) && !is_string($inventory_quantity)){?>
							<?php echo $this->partial('index/format/float.phtml','admin',array($location_contain_max*$inventory_quantity));?>
						<?php }else{?>
							
						<?php }?>
					</td>
				</tr>
				<?php }}?>
			</tbody>
			<tfoot>
				<tr>
					<td colspan='16'>
						<div class='container'>
							<?php if($this->paginator) echo $this->paginationControl($this->paginator) ?>
						</div>
					</td>
				</tr>
			</tfoot>
		</table>
	</fieldset>
	<!-- / -->
	
</dl>
</form>
